[PATCH 2/2] control: make Multi-Arch configurable
authorFabian Grünbichler <git@fabian.gruenbichler.email>
Wed, 23 Apr 2025 16:18:51 +0000 (18:18 +0200)
committerPeter Michael Green <plugwash@debian.org>
Tue, 6 May 2025 10:42:52 +0000 (10:42 +0000)
to allow overriding if needed, without the need to override all of
debian/control.

Signed-off-by: Fabian Grünbichler <git@fabian.gruenbichler.email>
Gbp-Pq: Name 0002-control-make-Multi-Arch-configurable.patch

debcargo.toml.example
src/config.rs
src/debian/control.rs

index 862b6c2946cb2f1245debf14424ef3aa301a5117..da55db029e0d5f0276f4af6cdc8c21df9d7f6b50 100644 (file)
@@ -196,6 +196,10 @@ uploaders = [ "foo bar <foo@debian.org>" ]
 #PLACEHOLDER
 #"""
 
+# Value for the Multi-Arch field of the package. If omitted, debcargo will
+# automatically set no value for 'bin', and 'same' for all 'lib' packages.
+#multi_arch = "no|same|foreign|allowed"
+
 # Additional Depends on top of the ones generated by debcargo. This should be
 # used to pull in system libraries for crates that need them to build. You'll
 # want the -dev versions of the library packages, since our crate packages are
index 773d739eef3bc570424229c0d3199c3bced959c5..f445e53f2191974d4ce9f8feb9a55990ce038219 100644 (file)
@@ -76,6 +76,7 @@ pub struct PackageOverride {
     section: Option<String>,
     summary: Option<String>,
     description: Option<String>,
+    multi_arch: Option<String>,
     depends: Option<Vec<String>>,
     recommends: Option<Vec<String>>,
     suggests: Option<Vec<String>>,
@@ -219,6 +220,10 @@ impl Config {
         self.with_package(key, |pkg| pkg.description.as_deref())
     }
 
+    pub fn package_multi_arch(&self, key: PackageKey) -> Option<&str> {
+        self.with_package(key, |pkg| pkg.multi_arch.as_deref())
+    }
+
     pub fn package_depends(&self, key: PackageKey) -> Option<&Vec<String>> {
         self.with_package(key, |pkg| pkg.depends.as_ref())
     }
index be745e7528b63b0981dbf402139a1d4b0dd22d06..eb46d810c2f82ae2e204c98d5a11d32364ee4f7d 100644 (file)
@@ -589,6 +589,9 @@ impl Package {
                 .flatten()
                 .map(|s| s.to_string()),
         );
+        if let Some(multi_arch) = config.package_multi_arch(key) {
+            self.multi_arch = Some(multi_arch.to_owned());
+        }
     }
 }